import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import {userType} from "./utils/base";
import 'default-passive-events'

//引入vant
import Vant from 'vant';
import 'vant/lib/index.css';
Vue.use(Vant);

//引入ElementUI
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI)

// import {getImg} from "./request/api";
// getImg('/media/card_photo/gd123456789.png').then(res =>{
//   console.log(res)
// })

// function blobToDataURL(blob, callback) {
//   let a = new FileReader();
//   a.onload = function (e) { callback(e.target.result); }
//   a.readAsDataURL(blob);
// }

import {Base64} from "js-base64";

// axios.get('https://api.ptaedu.cn/media/card_photo/gd123456789.png').then(res =>{
//   console.log(res)
//   // blobToDataURL(res.request.response,console.log)
//   // console.log(Base64.encode(res.data))
//   // imageToBase64(res.data)
// })

import {getBase64} from "./components/imgUpload/urlToBase";
// getBase64('http://test.ptaedu.cn/media2/1.png').then(res =>{
//   // this.$emit('upload',res);
//   console.log(res)
//   imageToBase64(res.data)
// })



//使用电子签名模块
import vueEsign from 'vue-esign'
Vue.use(vueEsign)

import VueCookies from 'vue-cookies'
import axios from "axios";
Vue.use(VueCookies)
let token = $cookies.get("token")
console.log('main-token',token);
if(token){
  let {user_type} = userType(token);
  let {user_name} = userType(token)
  store.commit('setUserType',user_type)
  store.commit('setUserName',user_name)
  store.commit('setToken',token)
  console.log('main-user_type',user_type);
}
Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

